	

package embuzzled.g5;

import java.awt.Color;

public class G5Puzzles extends PuzzleSet
{
        public G5Puzzles()
        {
                super();
               
                /* Word Puzzle */
                CompositeWordPuzzle cloudPuzzle = new CompositeWordPuzzle("cloud");
                cloudPuzzle.solution = "Letters spell out the word 'cloud.'";
                int[] placementCloud = {Constants.PLACEMENT_DIAGONAL_DOWN_RIGHT, Constants.PLACEMENT_HORIZONTAL, Constants.PLACEMENT_VERTICAL_DOWN};
                cloudPuzzle.setPlacementStrategies(placementCloud);
                cloudPuzzle.coloringStrategy = Constants.COLORING_RANDOM_NO_REPEAT;
               
                /* Moon Puzzle */
                CompositeWordPuzzle moonPuzzle = new CompositeWordPuzzle("MOON");
                moonPuzzle.solution = "Letters spell out the word 'moon'";
                int[] placementMoon = {Constants.PLACEMENT_HORIZONTAL, Constants.PLACEMENT_VERTICAL_DOWN, Constants.PLACEMENT_DIAGONAL_DOWN_RIGHT};
                moonPuzzle.setPlacementStrategies(placementMoon);
                moonPuzzle.coloringStrategy = Constants.COLORING_RANDOM_NO_REPEAT;
               
                /* Star Puzzle */
                SingleColorPuzzle starPuzzle = new SingleColorPuzzle(11,11);
                boolean[][] star =
                {{false, false, false, false, false, true, false, false, false, false, false},
                 {false, true, false, false, false, true, false, false, false, true, false},
                 {false, true, true, false, true, true, true, false, true, true, false},
                 {false, false, true, true, true, true, true, true, true, false, false},
                 {false, false, true, true, true, true, true, true, true, false, false},
                 {false, false, false, true, true, true, true, true, false, false, false},
                 {false, false, false, true, true, true, true, true, false, false, false},
                 {false, false, true, true, true, false, true, true, true, false, false},
                 {false, true, true, true, false, false, false, true, true, true, false},
                 {false, true, false, false, false, false, false, false, false, true, false},
                 {true, false, false, false, false, false, false, false, false, false, true}
                };
                starPuzzle.setColorMap(star);
                starPuzzle.setColor(Constants.ColorSelection[42]);
                starPuzzle.solution = "There is a large yellow star.";
                starPuzzle.coloringStrategy = Constants.COLORING_DO_NOT_COLOR;
               
                /* Rain puzzle */
                CompositePuzzle rainPuzzle = new CompositePuzzle();
                rainPuzzle.solution = "There is a grey cloud above raindrops, depicting rain.";
                PuzzleComponent rainCloudComponent = new PuzzleComponent(5,5);
                boolean[][] rainCloud =
                {{false, true, false, true, false},
                 {true, true, true, true, false},
                 {false, true, true, true, true},
                 {true, true, true, true, true},
                 {true, true, false, true, false},
                };
                rainCloudComponent.setColorMap(rainCloud);
                rainCloudComponent.setColor(Constants.ColorSelection[0]);
               
                rainPuzzle.add(rainCloudComponent);
               
                boolean[][] rain =
                {{true, false, false, false, false},
                 {true, false, true, false, false},
                 {false, false, true, false, true},
                 {false, false, false, false, true}
                };
               
                int raindrops = 3;
                for(int i = 0; i < raindrops; i++)
                {
                        PuzzleComponent rainComponent = new PuzzleComponent(4, 5);
                        rainComponent.setColorMap(rain);
                        rainComponent.setColor(Constants.ColorSelection[1]);
                        rainPuzzle.add(rainComponent);
                }
               
                int[] placementRain = {Constants.PLACEMENT_VERTICAL_DOWN};
               
                rainPuzzle.setPlacementStrategies(placementRain);
               
                rainPuzzle.coloringStrategy = Constants.COLORING_DO_NOT_COLOR;
               
                /* Moon phases puzzle */
                CompositePuzzle phasesPuzzle = new CompositePuzzle();
                phasesPuzzle.solution = "There are four phases of the moon in sequence: full, gibbous, half, and crescent.";
               
                PuzzleComponent phase1 = new PuzzleComponent(5,5);
                boolean[][] phase1Map =
                {{false, false, true, false, false},
                 {false, true, true, true, false},
                 {true, true, true, true, true},
                 {false, true, true, true, false},
                 {false, false, true, false, false}
                };
                phase1.setColorMap(phase1Map);
                phase1.setColor(Color.LIGHT_GRAY);
                phasesPuzzle.add(phase1);
               
                PuzzleComponent phase2 = new PuzzleComponent(5,5);
                boolean[][] phase2Map =
                {{false, false, true, false, false},
                 {false, false, true, true, false},
                 {false, true, true, true, true},
                 {false, false, true, true, false},
                 {false, false, true, false, false}
                };
                phase2.setColorMap(phase2Map);
                phase2.setColor(Color.LIGHT_GRAY);
                phasesPuzzle.add(phase2);
               
                PuzzleComponent phase3 = new PuzzleComponent(5,5);
                boolean[][] phase3Map =
                {{false, false, true, false, false},
                 {false, false, true, true, false},
                 {false, false, false, true, true},
                 {false, false, true, true, false},
                 {false, false, true, false, false}
                };
                phase3.setColorMap(phase3Map);
                phase3.setColor(Color.LIGHT_GRAY);
                phasesPuzzle.add(phase3);
               
                PuzzleComponent phase4 = new PuzzleComponent(5,5);
                boolean[][] phase4Map =
                {{false, false, true, false, false},
                 {false, false, false, true, false},
                 {false, false, false, true, true},
                 {false, false, false, true, false},
                 {false, false, true, false, false}
                };
                phase4.setColorMap(phase4Map);
                phase4.setColor(Color.LIGHT_GRAY);
                phasesPuzzle.add(phase4);
               
                phasesPuzzle.coloringStrategy = Constants.COLORING_DO_NOT_COLOR;
                int[] phasesPlacement = {Constants.PLACEMENT_DIAGONAL_DOWN_RIGHT, Constants.PLACEMENT_VERTICAL_DOWN, Constants.PLACEMENT_HORIZONTAL};
                phasesPuzzle.setPlacementStrategies(phasesPlacement);
               
                /* Big Dipper puzzle */
                SingleColorPuzzle bigDipperPuzzle = new SingleColorPuzzle(15,25);
                bigDipperPuzzle.setSolution("There are 2x2 squares depicting the Big Dipper constellation.");
               
                boolean[][] dipperMap = new boolean[15][25];
                makeStar(dipperMap, 0, 0);
                makeStar(dipperMap, 1, 5);
                makeStar(dipperMap, 5, 9);
                makeStar(dipperMap, 8, 13);
                makeStar(dipperMap, 12, 15);
                makeStar(dipperMap, 9, 23);
                makeStar(dipperMap, 13, 21);
               
                bigDipperPuzzle.setColorMap(dipperMap);
                bigDipperPuzzle.setColor(new Color(184,248,184));
                bigDipperPuzzle.coloringStrategy = Constants.COLORING_DO_NOT_COLOR;
               
                /* Rainbow Puzzle */
                CompositePuzzle rainbowPuzzle = new CompositePuzzle();
                rainbowPuzzle.solution = "There are tetrominoes in diagonal sequence depicting the colors of the rainbow";
                PuzzleComponent redComponent = new PuzzleComponent(2,3);
                boolean[][] red =
                { { true, true, false},
                  {false, true, true}          
                };
                redComponent.setColorMap(red);
                redComponent.setColor(Color.RED);
                rainbowPuzzle.add(redComponent);
               
                PuzzleComponent orangeComponent = new PuzzleComponent(2,3);
                boolean[][] orange =
                { { true, true, false},
                  {false, true, true}          
                };
                orangeComponent.setColorMap(orange);
                orangeComponent.setColor(Color.ORANGE);
                rainbowPuzzle.add(orangeComponent);
               
                PuzzleComponent yellowComponent = new PuzzleComponent(2,3);
                boolean[][] yellow =
                { { true, true, false},
                  {false, true, true}          
                };
                yellowComponent.setColorMap(yellow);
                yellowComponent.setColor(Color.YELLOW);
                rainbowPuzzle.add(yellowComponent);
               
                PuzzleComponent greenComponent = new PuzzleComponent(2,3);
                boolean[][] green =
                { { true, true, false},
                  {false, true, true}          
                };
                greenComponent.setColorMap(green);
                greenComponent.setColor(Color.GREEN);
                rainbowPuzzle.add(greenComponent);
               
                PuzzleComponent blueComponent = new PuzzleComponent(2,3);
                boolean[][] blue =
                { { true, true, false},
                  {false, true, true}          
                };
                blueComponent.setColorMap(blue);
                blueComponent.setColor(Color.BLUE);
                rainbowPuzzle.add(blueComponent);
               
                PuzzleComponent indigoComponent = new PuzzleComponent(2,3);
                boolean[][] indigo =
                { { true, true, false},
                  {false, true, true}          
                };
                indigoComponent.setColorMap(indigo);
                indigoComponent.setColor(new Color(102,0,255));
                rainbowPuzzle.add(indigoComponent);
               
                PuzzleComponent violetComponent = new PuzzleComponent(2,3);
                boolean[][] violet =
                { { true, true, false},
                  {false, true, true}          
                };
                violetComponent.setColorMap(violet);
                violetComponent.setColor(new Color(139,0,255));
                rainbowPuzzle.add(violetComponent);
               
                int[] placementRainbow = {Constants.PLACEMENT_DIAGONAL_DOWN_RIGHT};
               
                rainbowPuzzle.setPlacementStrategies(placementRainbow);
               
                rainbowPuzzle.coloringStrategy = Constants.COLORING_DO_NOT_COLOR;
               
                /* Orion Puzzle */
                SingleColorPuzzle orionPuzzle = new SingleColorPuzzle(18,13);
                boolean[][] orion = new boolean[18][13];
                /*{ {true, true, false, false, false, false, false, false, false, false, false, false, false},
          {true, true, false, false, false, false, false, false, false, false, false, true, true},
          {false, false, false, false, false, false, false, false, false, false, false, true, true},
          {false, false, false, false, false, false, false, false, false, false, false, false, false},
          {false, false, false, false, false, false, false, false, false, false, false, false, false},
          {false, false, false, false, false, false, false, false, false, false, false, false, false},
          {false, false, false, false, false, false, false, false, false, false, false, false, false},
          {false, false, false, false, false, false, false, false, false, true, true, false, false},
          {false, false, false, false, false, false, true, true, false, true, true, false, false},
          {false, false, false, true, true, false, true, true, false, false, false, false, false},
          {false, false, false, true, true, false, false, false, false, false, false, false, false},
          {false, false, false, false, false, false, false, false, false, false, false, false, false},
          {false, false, false, false, false, false, false, false, false, false, false, false, false},
          {false, false, false, false, false, false, false, false, false, false, false, false, false},
          {false, false, false, false, false, false, false, false, false, false, false, false, false},
          {false, false, false, false, false, false, false, false, false, false, false, false, false},
                  {true, true, false, false, false, false, false, false, false, false, false, true, true},
                  {true, true, false, false, false, false, false, false, false, false, false, true, true}
                };*/
                makeStar(orion, 0,0);
                makeStar(orion, 16, 0);
                makeStar(orion, 1, 11);
                makeStar(orion, 7, 9);
                makeStar(orion, 8, 6);
                makeStar(orion, 9, 3);
                makeStar(orion, 16, 11);
                orionPuzzle.setColorMap(orion);
                orionPuzzle.setColor(new Color(252,224,168));
                orionPuzzle.solution = "There are 2x2 squares depicting the Orion constellation.";
                orionPuzzle.coloringStrategy = Constants.COLORING_DO_NOT_COLOR;
               
                /* Butterfly Puzzle */
                SingleColorPuzzle butterflyPuzzle = new SingleColorPuzzle(10,11);
                boolean[][] butterfly =        
                 {{false, false, false, false, true, false, true, false, false, false, false},
                 {false, false, true, false, false, true, false, false, true, false, false},
                 {false, true, false, true, false, true, false, true, false, true, false},
                 {true, false, false, false, true, true, true, false, false, false, true},
                 {true, false, false, false, false, false, false, false, false, false, true},
                 {true, true, false, false, false, false, false, false, false, true, true},
                 {false, true, false, false, false, false, false, false, false, true, false},
                 {false, true, true, false, false, false, false, false, true, true, false},
                 {false, false, true, true, false, true, false, true, true, false, false},
                 {false, false, false, true, true, false, true, true, false, false, false}
                };
                butterflyPuzzle.setColorMap(butterfly);
                butterflyPuzzle.setColor(new Color(216,184,248));
                butterflyPuzzle.solution = "There is a butterfly";
                butterflyPuzzle.coloringStrategy = Constants.COLORING_DO_NOT_COLOR;
               
                /* Rocket Puzzle */
                SingleColorPuzzle rocketPuzzle = new SingleColorPuzzle(18,5);
                boolean[][] rocket =
                { {false, false, true, false, false},
		          {false, false, true, false, false},
		          {false, false, true, false, false},
		          {false, true, true, true, false},
		          {true, true, false, true, true},
		          {false, true, false, true, false},
		          {false, true, false, true, false},
		          {false, true, false, true, false},
		          {false, true, false, true, false},
		          {false, true, false, true, false},
		          {false, true, false, true, false},
		          {false, true, false, true, false},
		          {false, true, false, true, false},
		          {false, true, false, true, false},
		          {false, true, true, true, false},
		          {true, true, false, true, true},
		          {true, true, false, true, true},
		          {true, false, false, false, true}
                };
                rocketPuzzle.setColorMap(rocket);
                rocketPuzzle.setColor(Constants.ColorSelection[18]);
                rocketPuzzle.solution = "There is a rocket";
                rocketPuzzle.coloringStrategy = Constants.COLORING_DO_NOT_COLOR;
               
                /* Lightning Puzzle */
                SingleColorPuzzle lightningPuzzle = new SingleColorPuzzle(12, 8);
                boolean[][] lightningGrid =
                { {false, false, false, false, false, true, true, false},
                  {false, false, false, false, true, true, false, false},
                  {false, false, false, true, true, false, false, false},
                  {false, false, true, true, true, true, true, false},
                  {false, false, false, false, true, true, false, false},
                  {false, false, false, true, true, false, false, false},
                  {false, false, true, true, false, false, false, false},
                  {false, true, true, true, true, true, false, false},
                  {false, false, false, true, true, false, false, false},
                  {false, false, true, true, false, false, false, false},
                  {false, true, true, false, false, false, false, false},
                  {true, false, false, false, false, false, false, false}};
                lightningPuzzle.setColorMap(lightningGrid);
                lightningPuzzle.setColor(new Color(248,184,0));
                lightningPuzzle.coloringStrategy = Constants.COLORING_DO_NOT_COLOR;
                lightningPuzzle.solution = "There is a lightning bolt.";
               
                /* Eclipse Puzzle */
                MultiColorPuzzle eclipsePuzzle = new MultiColorPuzzle(10,11);
                eclipsePuzzle.solution = "There is a dark circle in an orange circle depicting a solar eclipse.";
                
				SingleColorPuzzle eclipseOuterPuzzle = new SingleColorPuzzle(10,11);
				boolean[][] eclipse = 	
				 {{false, false, false, true, true, true, true, false, false, false, false},
				  {false, false, true, false, false, false, true, true, false, false, false},
				  {false, true, false, false, false, false, false, true, true, false, false},
				  {true, false, false, false, false, false, false, false, true, true, false},
				  {true, false, false, false, false, false, false, false, true, true, false},
				  {true, false, false, false, false, false, false, false, true, true, false},
				  {true, false, false, false, false, false, false, false, true, true, false},
				  {false, true, false, false, false, false, false, true, true, false, false},
				  {false, false, true, false, false, false, true, true, false, false, false},
				  {false, false, false, true, true, true, true, false, false, false, false},
				};
				eclipseOuterPuzzle.setColorMap(eclipse);
				eclipseOuterPuzzle.setColor(new Color(248,184,0));
				eclipseOuterPuzzle.coloringStrategy = Constants.COLORING_DO_NOT_COLOR;
				
				SingleColorPuzzle eclipseInnerPuzzle = new SingleColorPuzzle(10,11);
				boolean[][] eclipseInnerGrid = 	
				 {{false, false, false, false, false, false, false, false, false, false, false},
				  {false, false, false, true, true, true, false, false, false, false, false},
				  {false, false, true, true, true, true, true, false, false, false, false},
				  {false, true, true, true, true, true, true, true, false, false, false},
				  {false, true, true, true, true, true, true, true, false, false, false},
				  {false, true, true, true, true, true, true, true, false, false, false},
				  {false, true, true, true, true, true, true, true, false, false, false},
				  {false, false, true, true, true, true, true, false, false, false, false},
				  {false, false, false, true, true, true, false, false, false, false, false},
				  {false, false, false, false, false, false, false, false, false, false, false},
				};
				eclipseInnerPuzzle.setColorMap(eclipseInnerGrid);
				eclipseInnerPuzzle.setColor(Color.DARK_GRAY);
				eclipseInnerPuzzle.coloringStrategy = Constants.COLORING_DO_NOT_COLOR;
				
				eclipsePuzzle.add(eclipseOuterPuzzle);
				eclipsePuzzle.add(eclipseInnerPuzzle);
				eclipsePuzzle.coloringStrategy = Constants.COLORING_DO_NOT_COLOR;
		
				/* Saturn Puzzle */
				SingleColorPuzzle saturnPuzzle = new SingleColorPuzzle(10,16);
				boolean[][] saturn = 
				{{false, false, false, false, false, false, true, true, true, true, false, false, true, true, true, false},
				 {false, false, false, false, false, true, false, false, false, false, true, true, false, false, false, true},
				 {false, false, false, false, true, false, false, false, false, false, false, true, false, false, false, true},
				 {false, false, false, true, false, false, false, false, false, false, false, false, true, false, true, false},
				 {false, false, false, true, false, false, false, false, false, false, false, false, true, true, false, false},
				 {false, false, true, true, false, false, false, false, false, false, true, true, true, false, false, false},
				 {false, true, false, true, false, false, false, false, true, true, false, false, true, false, false, false},
				 {true, false, false, false, true, false, true, true, false, false, false, true, false, false, false, false},
				 {true, false, false, false, true, true, false, false, false, false, true, false, false, false, false, false},
				 {false, true, true, true, false, false, true, true, true, true, false, false, false, false, false, false}
				};
				saturnPuzzle.setColorMap(saturn);
				saturnPuzzle.setColor(new Color(0,0,128)); //dark blue color
				saturnPuzzle.solution = "There is a circle with an elliptical path around it depicting the planet Saturn.";
				saturnPuzzle.coloringStrategy = Constants.COLORING_DO_NOT_COLOR;

               
                /* Add all puzzles */
				add(saturnPuzzle);  	// 10x16
				add(starPuzzle);		//11x11 
				add(eclipsePuzzle);		//10x11
				add(butterflyPuzzle);	//10x11
				add(lightningPuzzle);	//12x8
				add(rocketPuzzle);		//18 x 5
				
                add(bigDipperPuzzle);	//15 x 23, sparse
                add(orionPuzzle);		//18 x 13, sparse
                
                add(rainPuzzle);		//4 5x5 components, one placement strategy
                add(phasesPuzzle);		//4 5x5 components, all placement strategies
                add(rainbowPuzzle);		//7 2x3 components, only one placement strategy
                add(cloudPuzzle);		//5 3x3 components, all placement strategies
                add(moonPuzzle);		//5 3x3 components, all placement strategies
         
                /* Set colors */
                assignColors(Constants.ColorSelection);
               
        }
       
        //Makes putting 2x2 "stars" in large constellation puzzles easier.
        private void makeStar(boolean[][] map, int r, int c)
        {
                map[r][c] = true;
                map[r+1][c] = true;
                map[r][c+1] = true;
                map[r+1][c+1] = true;
        }
}

